package com.genexususa.eo.bing.data.results;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.BatchError;
import com.genexususa.eo.bing.CampaignManagementServiceClasses.EditorialError;
import com.genexususa.eo.bing.data.GxItemException;

import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Bing_VersionResults")
public class GxVersionResults extends GxGeneralResults {
    @XmlElementWrapper(name = "VersionResultCollection")
    @XmlElement(name = "VersionResult")
    public GxVersionResult[] versionResultCollection;

    public GxVersionResults() {
        super();
    }

    public GxVersionResults(String trackingId) {
        super(trackingId);
    }

    public GxVersionResults(String trackingId, int resultQuantity) {
        super(trackingId);
        this.versionResultCollection = new GxVersionResult[resultQuantity];
    }

    public void addResult(int index, GxVersionResult versionResult) {
        this.versionResultCollection[index] = versionResult;
    }

    public void addGxExceptionError(GxItemException error, int index) {
        this.versionResultCollection[index].addGxExceptionError(error, index);
    }

    public void addBatchError(BatchError error) {
        this.versionResultCollection[error.getIndex()].addBatchError(error);
    }

    public void addEditorialError(EditorialError error) {
        this.versionResultCollection[error.getIndex()].addEditorialError(error);
    }
}
